﻿using LimaLims.Core.Entity.Basic;
using LimaLims.Core.Entity.System;
using LimaLims.Core.Enum;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;

namespace LimaLims.Core.Entity.TestCenter
{
    /// <summary>
    /// 试验任务
    /// </summary>
    [Comment("试验任务")]
    public class ExperimentTask : DEntityTenant
    {
        /// <summary>
        /// 任务编号
        /// </summary>
        [Comment("任务编号")]
        public string TaskCode { get; set; }

        /// <summary>
        /// 试验计划ID
        /// </summary>
        [Comment("试验计划ID")]
        public long ExperimentPlanId { get; set; }

        public ExperimentPlan ExperimentPlan { get; set; }

        /// <summary>
        /// 试验员Id
        /// </summary>
        [Comment("试验员Id")]
        public long? ExperimentUserId { get; set; }

        /// <summary>
        /// 试验员名称
        /// </summary>
        [Comment("试验员名称")]
        public string ExperimentUserName { get; set; }


        /// <summary>
        /// 班组Id
        /// </summary>
        [Comment("班组Id")]
        public long TeamId { get; set; }

        /// <summary>
        /// 班组名称
        /// </summary>
        [Comment("班组名称")]
        public string TeamName { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        [Comment("计划开始时间")]
        public DateTime PlanStartTime { get; set; }

        /// <summary>
        /// 计划完成时间
        /// </summary>
        [Comment("计划完成时间")]
        public DateTime PlanEndTime { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        [Comment("实际开始时间")]
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际完成时间
        /// </summary>
        [Comment("实际完成时间")]
        public DateTime? ActualEndTime { get; set; }


        /// <summary>
        /// 试验对象Id
        /// </summary>
        [Comment("试验对象Id")]
        public long TargetId { get; set; }

        /// <summary>
        /// 试验对象编号
        /// </summary>
        [Comment("试验对象编号")]
        public string TargetCode { get; set; }

        /// <summary>
        /// 试验对象名称
        /// </summary>
        [Comment("试验对象名称")]
        public string TargetName { get; set; }

        /// <summary>
        /// 试验对象出厂编号
        /// </summary>
        [Comment("出厂编号")]
        public string FactoryNumbe { get; set; }


        [Comment("任务类型")]
        public ExperimentType TaskType { get; set; }

        /// <summary>
        /// 不良品处理结果
        /// </summary>
        [Comment("不良品处理结果Id")]
        public long RejectsHandlingId { get; set; }

        /// <summary>
        /// 不合格原因描述
        /// </summary>
        [Comment("不合格原因描述"), MaxLength(100)]
        public string RejectsRemark { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        [Comment("任务状态")]
        public ExperimentStatus Status { get; set; }

        /// <summary>
        /// 试验结果
        /// </summary>
        [Comment("试验结果")]
        public ExperimentResult? Result { get; set; }

        /// <summary>
        /// 试验报告URL
        /// </summary>
        [Comment("试验报告URL")]
        public string ReportUrl { get; set; }

    }
}
